package com.kscrm.web.controller.web;

import java.util.List;

import com.kscrm.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.kscrm.common.annotation.Log;
import com.kscrm.common.core.controller.BaseController;
import com.kscrm.common.core.domain.AjaxResult;
import com.kscrm.common.enums.BusinessType;
import com.kscrm.web.domain.ChannelFollowUp;
import com.kscrm.web.service.IChannelFollowUpService;
import com.kscrm.common.core.page.TableDataInfo;

/**
 * 渠道跟进内容Controller
 * 
 * @author Dhq
 * @date 2025-04-23
 */
@RestController
@RequestMapping("/web/channelFollowUp")
public class ChannelFollowUpController extends BaseController
{
    @Autowired
    private IChannelFollowUpService channelFollowUpService;

    /**
     * 查询渠道跟进内容列表
     */
    @GetMapping("/list")
    public TableDataInfo list(ChannelFollowUp channelFollowUp)
    {
        startPage();
        channelFollowUp.setUserId(SecurityUtils.getUserId());
        List<ChannelFollowUp> list = channelFollowUpService.selectChannelFollowUpList(channelFollowUp);
        return getDataTable(list);
    }

    /**
     * 获取渠道跟进内容详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(channelFollowUpService.selectChannelFollowUpById(id));
    }

    /**
     * 新增渠道跟进内容
     */
    @Log(title = "渠道跟进内容", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ChannelFollowUp channelFollowUp)
    {
        return toAjax(channelFollowUpService.insertChannelFollowUp(channelFollowUp));
    }

    /**
     * 修改渠道跟进内容
     */
    @PutMapping
    public AjaxResult edit(@RequestBody ChannelFollowUp channelFollowUp)
    {
        return toAjax(channelFollowUpService.updateChannelFollowUp(channelFollowUp));
    }

    /**
     * 删除渠道跟进内容
     */
    @Log(title = "渠道跟进内容", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(channelFollowUpService.deleteChannelFollowUpByIds(ids));
    }
}
